package page6;

import java.util.Scanner;

/**
 * 费马大定理：当n>2时，不定方程an+bn=cn没有整数解。比如a3+b3=c3没有正整数解。我们来给他开个玩笑：
 * 把方程改成a3+b3=c3，这样就有解了，比如a=4, b=9, c=79时43+93=793。
 * 输入两个整数x, y, 求满足x<=a,b,c<=y的整数解的个数。
 * @author chenxiaokang
 *
 */
public class Ques1670 {
	
	public void go(){
		Scanner scan = new Scanner(System.in);
		int n,m,k,count,index;
		index = 0;
		while(scan.hasNext()){
			n = scan.nextInt();
			m = scan.nextInt();
			k = 0;
			count = 0;
			index ++;
			for (int i = n; i <= 1000 && i <= m; i++) {
				for (int j = n; j <= 1000 && j <= m; j++) {
					k = i*i*i + j*j*j;
					if(k % 10 != 3){
						continue;
					}else{
						k = k / 10;
					}
					if(k >= n && k <= m){
						count ++;
					}
				}
			}	
			System.out.println("Case "+index+":"+count);
		}
	}
	
	public static void main(String[] args) {
		new Ques1670().go();
	}
}
